from sqlalchemy import Column, ForeignKey
from sqlalchemy.types import Integer
from sqlalchemy.orm import relationship
from __init__ import Base

class WidgetGroup(Base):

    __tablename__ = "widgetgroup"

    widgetid = Column(Integer, ForeignKey('widgets.id'), primary_key=True)
    groupid = Column(Integer, ForeignKey('groups.id'), primary_key=True)

    group = relationship("Groups")

    def __init__(self, widgetid, groupid):
        self.widgetid = widgetid
        self.groupid = groupid

    def __repr__(self):
        return "<WidgetGroup('%s', '%s')>" % format(self.widgetid, self.gridid)
